package com.nbsaas.boot.script.rest.convert;

import com.nbsaas.boot.script.data.entity.ScriptTemplate;
import com.nbsaas.boot.script.api.domain.response.ScriptTemplateResponse;

import com.nbsaas.boot.utils.BeanDataUtils;
import com.nbsaas.boot.rest.api.Converter;
import java.util.HashMap;
import java.util.Map;
/**
* -实体对象转化成响应对象
*/

public class ScriptTemplateResponseConvert  implements Converter<ScriptTemplateResponse,ScriptTemplate> {

    @Override
    public ScriptTemplateResponse convert(ScriptTemplate source) {
        ScriptTemplateResponse  result = new  ScriptTemplateResponse();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getJumpType()!=null){
                    Map<Integer,String> JumpTypeMap=new HashMap<>();
                        JumpTypeMap.put(1,"行跳转");
                        JumpTypeMap.put(2,"列跳转");
                        JumpTypeMap.put(3,"不跳转");
                    String label=  JumpTypeMap.get(source.getJumpType());
                    result.setJumpTypeName(label);
                    }
                    result.setJumpType(source.getJumpType());
                    if(source.getDataScope6()!=null){
                    Map<Integer,String> DataScope6Map=new HashMap<>();
                        DataScope6Map.put(1,"部分数据");
                        DataScope6Map.put(2,"全部数据");
                    String label=  DataScope6Map.get(source.getDataScope6());
                    result.setDataScope6Name(label);
                    }
                    result.setDataScope6(source.getDataScope6());
                    if(source.getPreType()!=null){
                    Map<Integer,String> PreTypeMap=new HashMap<>();
                        PreTypeMap.put(1,"进行预处理");
                        PreTypeMap.put(2,"不预处理");
                    String label=  PreTypeMap.get(source.getPreType());
                    result.setPreTypeName(label);
                    }
                    result.setPreType(source.getPreType());
                    if(source.getDataScope2()!=null){
                    Map<Integer,String> DataScope2Map=new HashMap<>();
                        DataScope2Map.put(1,"部分数据");
                        DataScope2Map.put(2,"全部数据");
                    String label=  DataScope2Map.get(source.getDataScope2());
                    result.setDataScope2Name(label);
                    }
                    result.setDataScope2(source.getDataScope2());
                    if(source.getDataScope3()!=null){
                    Map<Integer,String> DataScope3Map=new HashMap<>();
                        DataScope3Map.put(1,"部分数据");
                        DataScope3Map.put(2,"全部数据");
                    String label=  DataScope3Map.get(source.getDataScope3());
                    result.setDataScope3Name(label);
                    }
                    result.setDataScope3(source.getDataScope3());
                    if(source.getDataScope4()!=null){
                    Map<Integer,String> DataScope4Map=new HashMap<>();
                        DataScope4Map.put(1,"部分数据");
                        DataScope4Map.put(2,"全部数据");
                    String label=  DataScope4Map.get(source.getDataScope4());
                    result.setDataScope4Name(label);
                    }
                    result.setDataScope4(source.getDataScope4());
                    if(source.getDataScope5()!=null){
                    Map<Integer,String> DataScope5Map=new HashMap<>();
                        DataScope5Map.put(1,"部分数据");
                        DataScope5Map.put(2,"全部数据");
                    String label=  DataScope5Map.get(source.getDataScope5());
                    result.setDataScope5Name(label);
                    }
                    result.setDataScope5(source.getDataScope5());
                    if(source.getDataScope1()!=null){
                    Map<Integer,String> DataScope1Map=new HashMap<>();
                        DataScope1Map.put(1,"部分数据");
                        DataScope1Map.put(2,"全部数据");
                    String label=  DataScope1Map.get(source.getDataScope1());
                    result.setDataScope1Name(label);
                    }
                    result.setDataScope1(source.getDataScope1());
                    if(source.getType()!=null){
                    Map<Integer,String> TypeMap=new HashMap<>();
                        TypeMap.put(1,"公共查询");
                        TypeMap.put(2,"私有查询");
                    String label=  TypeMap.get(source.getType());
                    result.setTypeName(label);
                    }
                    result.setType(source.getType());
                    if(source.getSummaryType()!=null){
                    Map<Integer,String> SummaryTypeMap=new HashMap<>();
                        SummaryTypeMap.put(1,"汇总");
                        SummaryTypeMap.put(2,"不汇总");
                    String label=  SummaryTypeMap.get(source.getSummaryType());
                    result.setSummaryTypeName(label);
                    }
                    result.setSummaryType(source.getSummaryType());
                    if(source.getQueryType()!=null){
                    Map<Integer,String> QueryTypeMap=new HashMap<>();
                        QueryTypeMap.put(1,"分页");
                        QueryTypeMap.put(2,"报表");
                        QueryTypeMap.put(3,"批量查询");
                        QueryTypeMap.put(4,"待办");
                    String label=  QueryTypeMap.get(source.getQueryType());
                    result.setQueryTypeName(label);
                    }
                    result.setQueryType(source.getQueryType());
                    if(source.getDateLimit()!=null){
                    Map<Integer,String> DateLimitMap=new HashMap<>();
                        DateLimitMap.put(1,"限制");
                        DateLimitMap.put(2,"不限制");
                    String label=  DateLimitMap.get(source.getDateLimit());
                    result.setDateLimitName(label);
                    }
                    result.setDateLimit(source.getDateLimit());
                    if(source.getDebugMode()!=null){
                    Map<Integer,String> DebugModeMap=new HashMap<>();
                        DebugModeMap.put(1,"调试模式");
                        DebugModeMap.put(2,"运行模式");
                    String label=  DebugModeMap.get(source.getDebugMode());
                    result.setDebugModeName(label);
                    }
                    result.setDebugMode(source.getDebugMode());
        return result;
    }

}

